<!DOCTYPE html>
<html>
	{include file="public/header" /}

	<body>
		<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">
			<div class="layui-row">
				<div class="layui-col-xs6">

					<div class="layui-form-item">
						<label class="layui-form-label">订单号</label>
						<div class="layui-input-inline">
							<input type="text" name="OrderSn" lay-verify="required" placeholder="" autocomplete="off" class="layui-input" value="{$data.OrderSn}">
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">目前应还</label>
						<div class="layui-input-inline">
							订单应还-部分还款-豁免
							<input type="text" disabled="disabled" name="muqian_yinghuan_money" id="muqian_yinghuan_money" lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input" value="{$data.muqian_yinghuan_money}">

						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">本金豁免金额</label>
						<div class="layui-input-inline">
							<input type="number" id="huomian" name="benjin_homian_Money" lay-verify="required" placeholder="" autocomplete="off" class="layui-input" value="">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">本金豁免结果</label>
						<div class="layui-input-inline">
							<input type="text" id="jieguo" title="禁用" disabled name="benjin_homian_Money_re" lay-verify="required" placeholder="" autocomplete="off" class="layui-input" value="">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">收款方式</label>
						<div class="layui-input-inline">
							<select name="pay">
								<option value="7" selected="selected">豁免</option>

							</select>
						</div>
					</div>
				</div>
				<div class="layui-col-xs6">
					<div class="layui-form-item">
						<label class="layui-form-label">订单应还</label>
						<div class="layui-input-inline">
							到账金额+服务费+逾期费
							<input type="text" name="dingdan_yinghuan_money" lay-verify="required" disabled="disabled" placeholder="请输入用户名" autocomplete="off" class="layui-input" value="{$data.dingdan_yinghuan_money}">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">当前应还罚息</label>
						<div class="layui-input-inline">
							<input disabled="disabled" type="text" name="yuqimoney" id="faxi" lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input" value="{$data.yuqimoney}">
						</div>

					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">罚息豁免金额</label>
						<div class="layui-input-inline">
							<input type="number" name="faxi_homian_Money" id="faxi_huomian" placeholder="" autocomplete="off" class="layui-input" value="">

						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">罚息豁免结果</label>
						<div class="layui-input-inline">
							<input type="text" name="faxi_homian_Money_re" id="faxi_jieguo" placeholder="" autocomplete="off" class="layui-input" value="" disabled="disabled">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">还款类型</label>
						<div class="layui-input-inline">
							<select name="Type">
								<option value="3" selected="selected">豁免</option>

							</select>
						</div>
					</div>
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">剩余应还金额</label>
				<div class="layui-input-inline">
					目前应还-本金豁免-罚息豁免
					<input type="text" name="moneysheng" id="moneysheng" lay-verify="required" placeholder="" autocomplete="off" class="layui-input" value="" disabled="disabled">
				</div>
			</div>

			<input type="hidden" name="ID" lay-verify="required" placeholder="隐藏域 编辑用户ID" autocomplete="off" class="layui-input" value="{$data.ID}">
			<div class="layui-form-item layui-hide">
				<button class="layui-btn" lay-submit lay-filter="LAY-user-back-submit" id="LAY-user-back-submit">提交</button>
			</div>
		</div>
		{include file="public/footer" /}
		<script>
			layui.use(['form'], function() {
				var $ = layui.$,
					form = layui.form;
			})
			$("#huomian").change(function() {
				var benjin = $("#muqian_yinghuan_money").val();
				var huomian = $(this).val();
				if(huomian < 0) {
					alert('请输入正确的金额');
				}
				var jieguo = benjin - huomian;
				if(jieguo < 0) {
					alert('请输入正确的金额');
				} else {
					$("#jieguo").val(benjin + ' - ' + huomian + ' = ' + jieguo);
				}
				var benjin_huomian = $("#huomian").val(); //本金豁免
				var faxi_huomian = $("#faxi").val(); //罚息豁免

				//			    console.log(muqian_yinghuan_money);
				//			    console.log(benjin_huomian);
				//			    console.log(faxi_huomian);

				$moneysheng = benjin - benjin_huomian - faxi_huomian; //目前应还-本金豁免-罚息豁免
				if($moneysheng < 0) {
					alert('请输入正确的金额');
				} else {
					$("#moneysheng").val($moneysheng);
				}

			})
			$("#faxi_huomian").change(function() {
				var benjin = $("#faxi").val();
				var huomian = $(this).val();
				if(huomian < 0) {
					alert('请输入正确的金额');
				}
				var jieguo = benjin - huomian;
				if(jieguo < 0) {
					alert('请输入正确的金额');
				} else {
					$("#faxi_jieguo").val(benjin + ' - ' + huomian + ' = ' + jieguo);
				}
				var muqian_yinghuan_money = $("#muqian_yinghuan_money").val(); //目前应还
				var benjin_huomian = $("#huomian").val(); //本金豁免
				var faxi_huomian = $("#faxi").val(); //罚息豁免
				//			    console.log(muqian_yinghuan_money);
				//			    console.log(benjin_huomian);
				//			    console.log(faxi_huomian);
				$moneysheng = muqian_yinghuan_money - benjin_huomian - faxi_huomian; //目前应还-本金豁免-罚息豁免
				if($moneysheng < 0) {
					alert('请输入正确的金额');
				} else {
					$("#moneysheng").val($moneysheng);
				}
			})
		</script>
	</body>

</html>